<%@ page language="java" import="com.demo.util.Conn,java.sql.ResultSet" pageEncoding="UTF-8"%>
<%
String login = request.getParameter("login");
String pwd = request.getParameter("pwd");
String email = request.getParameter("email");
String stuno = request.getParameter("stuno");

String sql = "insert into dbf_stuuser(login,password,email,stuno) values ('" + login + "','" + pwd + "','" + email + "','" + stuno + "')";
Conn conn = new Conn();
boolean result = conn.update(sql);
String redirect_address = "../login.jsp";

if (result == true) {
	sql = "select * from dbf_stuuser where login='" + login + "'";
	
	ResultSet rs = conn.find(sql);
	if (null != rs && rs.next()) {
		session.setAttribute("user_id", rs.getString("STUUSER_ID"));
		session.setAttribute("user_type", "1");
		session.setAttribute("user_name", login);
		redirect_address = "index.jsp";
	}
}
response.sendRedirect(redirect_address);
%>